//2009/07/27 10:29:03
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

class CeyKaps
{
public:
	string decipher(string typed, vector <string> switches)
	{
		string p;
		p.clear();
		for(int i=0; i<typed.size(); i++)\
		{
			char cc = typed[i];
			for(int j=0; j<switches.size(); j++)
			{
				if(switches[j][0] == cc)
					cc = switches[j][2];
				else if(switches[j][2] == cc)
					cc = switches[j][0];
			}
			p += cc;
		}
		return p;
	}
};
//Partly from editorials of Topcoder.
